package com.by.task;

import com.by.mapper.OrderMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ScheduleTask {

    @Autowired
    OrderMapper orderMapper;
    /**
     * 每分钟执行一次
     */
    @Scheduled(cron = "0 0/1 * * * ?")
    public void cancelOrder(){
        log.info("执行定时取消订单任务......");
        int rs = orderMapper.updateOrder();
        if(rs>0){
            log.info(">>>>>>取消订单:"+rs);
        }

    }
}
